<template>
    <div class="supplier" ref="supplier">
        <!-- <topBar :supplierData="supplier"></topBar> -->
        <!-- <router-view/> -->
        <div class="center-block0">
            <div class="left-block">
                <div class="oneBlock ">
                    <carousel></carousel>
                </div>
                <div class="oneBlock">
                    <supplierArchives></supplierArchives>
                </div>
                <div class="oneBlock">
                    <supplyProducts :products="products"></supplyProducts>
                </div>
                <div class="oneBlock">
                    <supplierRecent></supplierRecent>
                </div>
            </div>
            <div class="right-block">
                <right-bar class="right-bar" title="热门排行">
                    <ranking :ranking="ranking"></ranking>
                </right-bar>
                <right-bar class="right-bar" title="最近更新">
                    <rececntUpdate :updating="updating"></rececntUpdate>
                </right-bar>
                <right-bar class="right-bar" title="产品成熟时间">
                    <productMature :matureTime="mature"></productMature>
                </right-bar>
            </div>       
        </div>
    </div>
</template>

<script>
import topBar from '@/components/SupplierBar'
import carousel from './Carousel'
import supplierArchives from './Archives'
import supplyProducts from './Products'
import supplierRecent from './Recent'
import ranking from './RightBar/ranking.vue'
import rececntUpdate from './RightBar/recentUpdate.vue'
import productMature from './RightBar/productMature.vue'
import RightBar from './RightBar'
export default {
    name:'supplier',
    components:{
        topBar,
        carousel,
        supplierArchives,
        supplyProducts,
        supplierRecent,
        ranking,
        rececntUpdate,
        productMature,
        RightBar,
    },
    data() {
        return {
            scrollHeightOfComponents:{
                'index':0,//首页
                'supplyProducts':1050,//供应产品
                'supplierArchives':500,//企业档案
                'supplierRecent':2050,//企业动态
            },
            supplier:{
                barginAmount:1.1,
                name:'企业名',
                avgScore:5,
                inquiryPriceNum:241,
                visitors:1789,
                mainProduct:['花生','红薯','生菜','柑橘','哈密瓜','苹果']
            },
            p_o_v:[
                require('./img/水果.png'),
                require('./img/水稻.png'),
                'https://view.2amok.com/2019716/0b03bff15125a7fc441285ee8b27137a.mp4'
            ],
            products:[
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.0,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.1,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.2,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.3,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.4,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.5,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.6,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.6,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.6,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.6,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.6,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.6,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.6,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.6,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.6,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
                {'product_name':'广西小米蕉新鲜香蕉当季水果小八角苹果蕉粉蕉','price':6.8,'delivery_time':72,'bargin_amount':5894.3,'url':require('./img/香蕉.jpg')},
            ],
            ranking:[
                {'popularity':5,'productName':'香蕉','price':6.6,'barginAmount':5555.5,'picUrl':require('./img/香蕉.jpg')},
                {'popularity':5,'productName':'香蕉','price':6.6,'barginAmount':4444.4,'picUrl':require('./img/香蕉.jpg')},
                {'popularity':4,'productName':'香蕉','price':6.6,'barginAmount':3333.3,'picUrl':require('./img/香蕉.jpg')},
                {'popularity':3,'productName':'香蕉','price':6.6,'barginAmount':2222.2,'picUrl':require('./img/香蕉.jpg')},
                {'popularity':2,'productName':'香蕉','price':6.6,'barginAmount':1111.1,'picUrl':require('./img/香蕉.jpg')},
                {'popularity':1,'productName':'香蕉','price':6.6,'barginAmount':900.0,'picUrl':require('./img/香蕉.jpg')},
            ],
            updating:[
                {'updateTime':'2022-12-01','productName':'香蕉','price':6.6,'barginAmount':5555.5,'picUrl':require('./img/香蕉.jpg')},
                {'updateTime':'2022-12-01','productName':'香蕉','price':6.6,'barginAmount':4444.4,'picUrl':require('./img/香蕉.jpg')},
                {'updateTime':'2022-12-01','productName':'香蕉','price':6.6,'barginAmount':3333.3,'picUrl':require('./img/香蕉.jpg')},
                {'updateTime':'2022-12-01','productName':'香蕉','price':6.6,'barginAmount':2222.2,'picUrl':require('./img/香蕉.jpg')},
                {'updateTime':'2022-12-01','productName':'香蕉','price':6.6,'barginAmount':1111.1,'picUrl':require('./img/香蕉.jpg')},
                {'updateTime':'2022-12-01','productName':'香蕉','price':6.6,'barginAmount':900.0,'picUrl':require('./img/香蕉.jpg')},
            ],
            mature:[
                {'productName':'香蕉','matureTime':['一月底','一月底','一月底'],'url':require('./img/香蕉.jpg')},
                {'productName':'香蕉','matureTime':['一月底','一月底','一月底'],'url':require('./img/香蕉.jpg')},
                {'productName':'香蕉','matureTime':['一月底','一月底','一月底'],'url':require('./img/香蕉.jpg')},
                {'productName':'香蕉','matureTime':['一月底','一月底','一月底'],'url':require('./img/香蕉.jpg')},
                {'productName':'香蕉','matureTime':['一月底','一月底','一月底'],'url':require('./img/香蕉.jpg')},
            ],
            recentMessage:[
                {'time':'2021-11-13 14:00:00','text':'花生米','picUrlArr':[require('./img/香蕉.jpg'),require('./img/香蕉.jpg')]},
                {'time':'2021-11-13 13:00:00','text':'花生米','picUrlArr':[require('./img/香蕉.jpg'),require('./img/香蕉.jpg')]},
                {'time':'2021-11-13 12:00:00','text':'花生米','picUrlArr':[require('./img/香蕉.jpg'),require('./img/香蕉.jpg')]},
                {'time':'2021-11-13 11:00:00','text':'花生米','picUrlArr':[require('./img/香蕉.jpg'),require('./img/香蕉.jpg')]},
                {'time':'2021-11-13 10:00:00','text':'花生米','picUrlArr':[require('./img/香蕉.jpg'),require('./img/香蕉.jpg')]},
                {'time':'2021-11-13 09:00:00','text':'花生米','picUrlArr':[require('./img/香蕉.jpg'),require('./img/香蕉.jpg')]},
                {'time':'2021-11-13 08:00:00','text':'花生米','picUrlArr':[require('./img/香蕉.jpg'),require('./img/香蕉.jpg')]},
            ]
        }
    },
    mounted(){
        this.$nextTick(() => {
            if(this.$route.query.destination !== undefined && this.$route.query.destination in this.scrollHeightOfComponents) 
                window.scrollTo(0,this.scrollHeightOfComponents[this.$route.query.destination])
        })
    },
    watch:{
        '$route'(to, from) {
            if(to.query.destination !== undefined && to.query.destination in this.scrollHeightOfComponents)
                window.scrollTo(0,this.scrollHeightOfComponents[to.query.destination])
        },
    },
    created() {
        if (this.$route.query.pid) this.$router.push({
            path: "/supplier/product",
            query: {
                pid: this.$route.query.pid
            }
        })
    }
}
</script>

<style lang="less" scoped>
.supplier{
    width: @width-content;
    background-color: rgb(243, 239, 239);
    margin: 0 auto;
    .center-block0{
        overflow: hidden;
        display: flex;
        justify-content: space-around;
        padding-bottom: 20px;
        .left-block{
            width: 70%;
            .oneBlock{
                margin-top: 20px;
                background-color: white;
                overflow: hidden; //开启BFC
            }
        }
        .right-block{
            width: 25%;
            .right-bar{
                margin-top: 20px;
            }
        }
    }
}

</style>